home *** CD-ROM | disk | FTP | other *** search
/ Mac Power 1997 December / MACPOWER-1997-12.ISO.7z / MACPOWER-1997-12.ISO / AMUG / PROGRAMMING / Raven 1.2.sit / Raven 1.2 / • Extras • / SGI STL / (config) / configure.in next >
Text File  |  1997-05-28  |  21KB  |  753 lines

  1. dnl Disable any caching here 
  2. define([AC_CACHE_LOAD], )dnl
  3. define([AC_CACHE_SAVE], )dnl
  4. dnl Process this file with autoconf to produce a configure script.
  5. AC_INIT(stlconf.h)
  6. AC_CONFIG_HEADER(stlconf.h:config/stlconf.h)
  7.  
  8. AC_MSG_RESULT(*** $0: Adapted SGI STL configuration utility ***)
  9. if test "${CXXFLAGS}" = ""; then 
  10. AC_MSG_RESULT(* Note: for best reliability - try ¥"CXXFLAGS=-treat_warnings_as_errors¥" $0 )
  11. AC_MSG_RESULT(* Please don't forget specifying typical CXXFLAGS you'll be using - ) 
  12. AC_MSG_RESULT(* such as that enabling exceptions handling, etc. )
  13. dnl AC_MSG_RESULT(* Add option forcing instantiation of all templates to CXXFLAGS if possible. )
  14. fi
  15. AC_MSG_RESULT(Please stand by while exploring compiler capabilities...)
  16. AC_MSG_RESULT(Be patient - that may take a while...)
  17. AC_MSG_RESULT(***)
  18.  
  19. # utility function
  20. check_warning () {
  21.     warn_str=`tail -1 config.log | grep -i warning`
  22.     if test "$warn_str" = ""; then
  23.       return 0
  24.     else
  25.      return 1
  26.     fi
  27. }
  28.  
  29. dnl Checks for systems
  30. dnl AC_AIX
  31. dnl Checks for programs.
  32. dnl sets CXX
  33. AC_PROG_CXX
  34. AC_LANG_CPLUSPLUS
  35.  
  36. AC_CHECK_SIZEOF(int,4)
  37. if test "$ac_cv_sizeof_int" = "4"; then
  38.   AC_DEFINE_UNQUOTED(__STL_UINT32_T,unsigned int)
  39. else
  40.   AC_CHECK_SIZEOF(long,4)
  41.   if test "$ac_cv_sizeof_long" = "4"; then
  42.     AC_DEFINE_UNQUOTED(__STL_UINT32_T,unsigned long)
  43.   else
  44.   dnl ELBRUS ??? ;)
  45.     AC_CHECK_SIZEOF(short,4)
  46.     if test "$ac_cv_sizeof_short" = "4"; then
  47.       AC_DEFINE_UNQUOTED(__STL_UINT32_T,unsigned short)
  48.     else
  49.       AC_MSG_ERROR(Cannot find any 32-bit integer type for your compiler)
  50.     fi
  51.   fi
  52. fi
  53.  
  54. ac_ext="cpp"
  55.  
  56. dnl Exclude link stage for cross-compilation
  57. if test "$ac_cv_c_cross" = "yes"; then
  58.   CXXFLAGS="${CXXFLAGS} -c"
  59. fi
  60.  
  61. dnl checking for compiler capabilities
  62. AC_MSG_CHECKING(for basic STL compatibility)
  63. AC_TRY_LINK( [
  64. template <class Arg1, class Arg2, class Result>
  65. struct binary_function {
  66.     typedef Arg1 first_argument_type;
  67.     typedef Arg2 second_argument_type;
  68.     typedef Result result_type;
  69. };      
  70. template <class T>
  71. struct plus : public binary_function<T, T, T> {
  72.     T operator()(const T& x, const T& y) const;
  73. };
  74.  
  75. template <class T>
  76. T plus<T>::operator()(const T& x, const T& y) const { return x + y; }
  77. plus<int> p;
  78. ],
  79. [], 
  80. [ac_cv_compat="yes"],
  81. [AC_MSG_ERROR(Your compiler won't be able to compile this implementation. Sorry.) 
  82.  ac_cv_compat="no"]
  83. )
  84. AC_MSG_RESULT($ac_cv_compat)
  85.  
  86. AC_MSG_CHECKING(for new header naming convention)
  87. AC_TRY_COMPILE(
  88.     [#include <new>],
  89.     [],
  90.     [AC_DEFINE(__STL_NEW_HEADER_NAMES) ac_cv_newheaders="yes"],
  91.     [ac_cv_newheaders="no"])
  92. AC_MSG_RESULT($ac_cv_newheaders)
  93.  
  94. AC_MSG_CHECKING(for bool keyword)
  95. AC_TRY_COMPILE(
  96.     [bool b_foo() { return true; }],
  97.     [(void)b_foo();],
  98.     [AC_DEFINE(__STL_BOOL_KEYWORD) ac_cv_bool="yes"],
  99.     [ac_cv_bool="no"])
  100. AC_MSG_RESULT($ac_cv_bool)
  101. if test "$ac_cv_bool" = "no"; then
  102.   AC_MSG_CHECKING(for yvals.h header)
  103.   AC_TRY_COMPILE([#include <yvals.h> 
  104.     extern bool aaa=true;
  105.    ], [], 
  106.   [AC_DEFINE(__STL_YVALS_H) AC_MSG_RESULT(yes) ], 
  107.   [
  108.   AC_MSG_RESULT(no)
  109.   AC_MSG_CHECKING(whether bool is reserved word)
  110.   AC_TRY_COMPILE(
  111.     [typedef int bool;],
  112.     [],
  113.     [ac_cv_bool_reserved="no"],
  114.     [AC_DEFINE(__STL_RESERVED_BOOL_KEYWORD) ac_cv_bool_reserved="yes"])
  115.   AC_MSG_RESULT($ac_cv_bool_reserved)
  116.   ])
  117. fi
  118.  
  119. AC_MSG_CHECKING(for wchar_t type)
  120. AC_TRY_COMPILE(
  121.     [wchar_t wc_foo() { return 'a'; }],
  122.     [(void)wc_foo();],
  123.     [AC_DEFINE(__STL_WCHAR_T) ac_cv_wchar="yes"],
  124.     [ac_cv_wchar="no"])
  125. AC_MSG_RESULT($ac_cv_wchar)
  126.  
  127. AC_MSG_CHECKING(for long long type)
  128. AC_TRY_COMPILE(
  129.     [long long ll_foo() { return 0; }],
  130.     [(void)ll_foo();],
  131.     [AC_DEFINE(__STL_LONG_LONG) ac_cv_long_long="yes"],
  132.     [ac_cv_long_long="no"])
  133. AC_MSG_RESULT($ac_cv_long_long)
  134.  
  135. AC_MSG_CHECKING(for long double type)
  136. AC_TRY_COMPILE(
  137.     [long double ld_foo() { return 0; }],
  138.     [(void)ld_foo();],
  139.     [AC_DEFINE(__STL_LONG_DOUBLE) ac_cv_long_double="yes"],
  140.     [ac_cv_long_double="no"])
  141. AC_MSG_RESULT($ac_cv_long_double)
  142.  
  143. AC_MSG_CHECKING(for member templates)
  144. AC_TRY_LINK( [
  145. template <class Result>
  146. struct mt_foo {
  147.     typedef Result result_type;
  148.     template <class Arg> result_type operate(const Arg&);
  149. };      
  150. mt_foo<int> p;
  151. ],
  152. [], 
  153. [AC_DEFINE(__STL_MEMBER_TEMPLATES) ac_cv_member_templates="yes"],
  154. [ac_cv_member_templates="no"]
  155. )
  156. AC_MSG_RESULT($ac_cv_member_templates)
  157.  
  158. AC_MSG_CHECKING(for friend templates)
  159. AC_TRY_LINK( [
  160. template <class Result>
  161. struct ft_foo {
  162.     typedef Result result_type;
  163.     template <class Result2> friend class foo<Result2>;
  164. };      
  165. ft_foo<int> p;
  166. ],
  167. [], 
  168. [AC_DEFINE(__STL_FRIEND_TEMPLATES) ac_cv_friend_templates="yes"],
  169. [ac_cv_friend_templates="no"]
  170. )
  171. AC_MSG_RESULT($ac_cv_friend_templates)
  172.  
  173.  
  174. AC_MSG_CHECKING(for partial class specialization)
  175. AC_TRY_LINK( [
  176. template <class Arg,class Result>
  177. struct ps_foo {
  178.     typedef Arg argument_type;
  179.     typedef Result result_type;
  180. };   
  181.  
  182. template<class Result>
  183. struct ps_foo<Result*,Result*> {
  184.     void bar() {}
  185. };
  186.  
  187. template<class Result>
  188. struct ps_foo<int*,Result> {
  189.     void foo() {}
  190. };
  191.  
  192. ps_foo<char*, char*> p;
  193. ps_foo<int*, int> p1;
  194. ],
  195. [p.bar();
  196.  p1.foo();], 
  197. [AC_DEFINE(__STL_CLASS_PARTIAL_SPECIALIZATION) ac_cv_partial_spec="yes"],
  198. [ac_cv_partial_spec="no"]
  199. )
  200. AC_MSG_RESULT($ac_cv_partial_spec)
  201.  
  202.  
  203. AC_MSG_CHECKING(for partial template function ordering)
  204. AC_TRY_LINK( [
  205. template<class Result>
  206. Result po_foo (const int& a, const Result&){ return (Result)a; }   
  207. template <class Arg,class Result>
  208. Result po_foo (const Arg& a,const Result&){ return (Result)a.nothing; }  
  209. ],
  210. [ int po_b; char po_a; (void)po_foo(po_b, po_a);],
  211. [AC_DEFINE(__STL_FUNC_PARTIAL_ORDERING) ac_cv_partial_ord="yes"],
  212. [ac_cv_partial_ord="no"]
  213. )
  214. AC_MSG_RESULT($ac_cv_partial_ord)
  215.  
  216.  
  217. AC_MSG_CHECKING(for lrand48 function)
  218. AC_TRY_LINK(
  219.     [#include <stdlib.h>],
  220.     [long i = lrand48();],
  221.     [AC_DEFINE(__STL_RAND48) ac_cv_func_lrand48="yes"],
  222.     [ac_cv_func_lrand48="no"])
  223. AC_MSG_RESULT($ac_cv_func_lrand48)
  224.  
  225.  
  226. AC_MSG_CHECKING(for default template parameters)
  227. AC_TRY_LINK(
  228.     [template <class T> struct less {}; 
  229.      template <class T, class T1=less<T> > struct Class { T1 t1; };
  230.      Class<int> cl;
  231.      Class<int,less<short> > cl2;
  232.     ],
  233.     [],
  234.     [AC_DEFINE(__STL_DEFAULT_TEMPLATE_PARAM) ac_cv_default_template_param="yes"],
  235.     [ac_cv_default_template_param="no"])
  236. AC_MSG_RESULT($ac_cv_default_template_param)
  237. if test "$ac_cv_default_template_param" = "no"; then
  238.   AC_MSG_CHECKING(for default type parameters)
  239.   AC_TRY_LINK(
  240.     [
  241. template <class T> class less {}; 
  242.  
  243. template <class T, class T1=less<int> > 
  244. struct Class { 
  245. private:
  246.        int a;
  247. public:
  248.        typedef Class<T,T1> self; 
  249.        self foo (const self& t) { 
  250.          if ( t.a==0 ) return *this;
  251.          else return t;
  252.          } 
  253. };
  254.  
  255. Class<int> cl;
  256. Class<int,less<short> > cl2;
  257.     ],
  258.     [],
  259.     [AC_DEFINE(__STL_DEFAULT_TYPE_PARAM) ac_cv_default_type_param="yes"],
  260.     [ac_cv_default_type_param="no"])
  261.   AC_MSG_RESULT($ac_cv_default_type_param) 
  262. fi
  263.  
  264. AC_MSG_CHECKING(for static data member templates)
  265. AC_TRY_LINK(
  266.     [template <class T> struct Class { static int a; };
  267.      template <class T> int Class<T>::a;],
  268.     [],
  269.     [AC_DEFINE(__STL_STATIC_TEMPLATE_DATA) ac_cv_static_templates="yes"],
  270.     [ac_cv_static_templates="no"])
  271. AC_MSG_RESULT($ac_cv_static_templates)
  272. if test "$ac_cv_static_templates" = no; then
  273.  AC_MSG_CHECKING(for weak attribute)
  274.  AC_TRY_COMPILE(
  275.     [int a_w __attribute__((weak));],
  276.     [],
  277.     [AC_DEFINE(__STL_WEAK_ATTRIBUTE) ac_cv_weak_attribute="yes"],
  278.     [ac_cv_weak_attribute="no"])
  279.  AC_MSG_RESULT($ac_cv_weak_attribute)
  280. fi
  281.  
  282. AC_MSG_CHECKING(for namespaces support)
  283. AC_TRY_COMPILE(
  284.     [namespace std { 
  285.       template <class T> struct Class { typedef T my_type; };
  286.       typedef Class<int>::my_type int_type;
  287.     }; 
  288.     inline int ns_foo (std::int_type t) { 
  289.       using namespace std; 
  290.       int_type i =2;
  291.       return i+t; 
  292.     }
  293.     namespace my_std=std; 
  294.      ],
  295.     [(void)ns_foo(1);],
  296.     [ac_cv_namespaces="yes"],
  297.     [ac_cv_namespaces="no"])
  298. if test "$ac_cv_namespaces" = yes; then
  299. # check if no warnings have been issued
  300.   if `check_warning` ; then
  301.     AC_DEFINE(__STL_NAMESPACES)
  302.   else
  303.    ac_cv_namespaces=no
  304.   fi
  305. fi
  306. AC_MSG_RESULT($ac_cv_namespaces)
  307.  
  308. AC_MSG_CHECKING(for typename keyword)
  309. AC_TRY_LINK(
  310.     [
  311. template <class T1, class T2>
  312. struct pair {
  313.     typedef T1 first_type;
  314.     typedef T2 second_type;
  315. };
  316.  
  317. template <class Arg, class Result>
  318. struct unary_function {
  319.     typedef Arg argument_type;
  320.     typedef Result result_type;
  321. };
  322.  
  323. template <class Pair>
  324. struct select2nd : public unary_function<Pair, typename Pair::second_type> {
  325.   typedef typename Pair::first_type ignored_type;
  326.   const typename Pair::second_type& operator()(const typename Pair::second_type& x,
  327.                         const ignored_type& ) const
  328.   {
  329.     return x;
  330.   }
  331.   
  332. };
  333.     ],
  334.     [ 
  335.     typedef pair<int,int> tn_p;
  336.     select2nd< tn_p > tn_s;
  337.     (void)tn_s(1,5);
  338.     ],
  339.     [__TYPENAME="typename" AC_DEFINE(__STL_TYPENAME) ac_cv_typename="yes"],
  340.     [__TYPENAME="" ac_cv_typename="no"])
  341. AC_MSG_RESULT($ac_cv_typename)
  342.  
  343. AC_MSG_CHECKING(for explicit keyword)
  344. AC_TRY_COMPILE(    
  345.     [struct expl_Class { int a; explicit expl_Class(int t): a(t) {} };
  346.     expl_Class c(1);
  347.     ],
  348.     [],
  349.     [AC_DEFINE(__STL_EXPLICIT) ac_cv_explicit="yes"],
  350.     [ac_cv_explicit="no"])
  351. AC_MSG_RESULT($ac_cv_explicit)
  352.  
  353. AC_MSG_CHECKING(for mutable keyword)
  354. AC_TRY_COMPILE(    
  355.     [struct mut_Class { mutable int a; void update() const { a=0; }  };
  356.     mut_Class c;
  357.     ],
  358.     [c.update()],
  359.     [AC_DEFINE(__STL_MUTABLE) ac_cv_mutable="yes"],
  360.     [ac_cv_mutable="no"])
  361. AC_MSG_RESULT($ac_cv_mutable)
  362.  
  363. AC_MSG_CHECKING(for new style casts)
  364. AC_TRY_COMPILE(    
  365.     [struct ncast_Class { 
  366.     int a; void update(int* i) { *i=a; }  };
  367.     ncast_Class c;
  368.     ],
  369.     [
  370.   const int a(5);
  371.   c.update(const_cast<int*>(&a))
  372.     ],
  373.     [AC_DEFINE(__STL_NEW_STYLE_CASTS) ac_cv_new_cast="yes"],
  374.     [ac_cv_new_cast="no"])
  375. AC_MSG_RESULT($ac_cv_new_cast)
  376.  
  377. AC_MSG_CHECKING(for exceptions support)
  378. AC_TRY_COMPILE(
  379.     [int ex_foo() { 
  380.        try { 
  381.          try { throw(1); } 
  382.          catch (int a) { throw; } 
  383.        } catch (...) {;} 
  384.       return 0;
  385.     }],
  386.     [(void)ex_foo();],
  387.     [ac_cv_exceptions="yes" ],
  388.     [ac_cv_exceptions="no"])
  389. AC_MSG_RESULT($ac_cv_exceptions)
  390. if test "$ac_cv_exceptions" = yes; then
  391.  AC_DEFINE(__STL_USE_EXCEPTIONS)
  392.  AC_MSG_CHECKING(if exceptions specification make things better)
  393.  AC_TRY_COMPILE(
  394.     [template <class T> inline int ex_spec_foo(const T&) throw () { return 0;} ], 
  395.     [(void)ex_spec_foo(5);],
  396.     [ac_cv_exception_spec="yes"],
  397.     [ac_cv_exception_spec="no"])
  398.     if test "$ac_cv_exception_spec" = yes; then
  399.     # check if no warnings have been issued
  400.      if `check_warning` ; then
  401.        AC_DEFINE(__STL_EXCEPTION_SPEC)
  402.      else
  403.       ac_cv_exception_spec=no
  404.      fi
  405.     fi
  406.  AC_MSG_RESULT($ac_cv_exception_spec)
  407. fi
  408.  
  409. AC_MSG_CHECKING(for templates baseclass matching)
  410. AC_TRY_LINK(
  411.     [struct output_iterator_tag {};
  412.      template<class T> struct output_iterator {};
  413.      template<class T> inline output_iterator_tag
  414.      iterator_category(const output_iterator<T>&) {return output_iterator_tag();}
  415.      struct derived_iterator : public output_iterator<int> {};
  416.      template<class T> inline T select_foo(T t, output_iterator_tag) { return (int)t;}
  417.      inline int tbase_foo()  { return select_foo(1,iterator_category(derived_iterator())); }],
  418.     [(void)tbase_foo();],
  419.     [ac_cv_base_match="yes"],
  420.     [AC_DEFINE(__STL_BASE_MATCH_BUG) ac_cv_base_match="no"])
  421. AC_MSG_RESULT($ac_cv_base_match)
  422.  
  423. AC_MSG_CHECKING(for nested type parameters bug)
  424. AC_TRY_LINK(
  425.     [template<class T> struct nt_o { typedef int ii; inline ii foo(ii);};
  426.      template <class T> inline nt_o<T>::ii nt_o<T>::foo(ii) { return 0; }],
  427.     [],
  428.     [ac_cv_nested_type_param_bug="no"],
  429.     [AC_DEFINE(__STL_NESTED_TYPE_PARAM_BUG) ac_cv_nested_type_param_bug="yes"])
  430. AC_MSG_RESULT($ac_cv_nested_type_param_bug)
  431.  
  432.  
  433. AC_MSG_CHECKING(if inherited template typedefs broken completely)
  434. AC_TRY_LINK(
  435.     [
  436. template <class Arg1, class Arg2, class Result>
  437. struct binary_function {
  438.     typedef Arg1 first_argument_type;
  439.     typedef Arg2 second_argument_type;
  440.     typedef Result result_type;
  441. };     
  442.  
  443.  
  444. template <class T>
  445. class plus : public binary_function<T, T, T> {
  446. public:
  447.     T operator()(const T& x, const second_argument_type& y) const { return x + y; };
  448. };
  449.  
  450. plus<int> p;
  451.  ],
  452.     [(void)p(1,2)],
  453.     [ac_cv_typebug="no"],
  454.     [AC_DEFINE(__STL_BASE_TYPEDEF_BUG) 
  455.      AC_DEFINE(__STL_BASE_TYPEDEF_OUTSIDE_BUG) ac_cv_typebug="yes"])
  456. AC_MSG_RESULT($ac_cv_typebug)
  457.  
  458. if test "$ac_cv_typebug" = "no"; then
  459. AC_MSG_CHECKING(if inherited typedefs visible from outside)
  460. AC_TRY_COMPILE(
  461.     [
  462. template <class Arg1, class Arg2, class Result>
  463. struct binary_function {
  464.     typedef Arg1 first_argument_type;
  465.     typedef Arg1 second_argument_type;
  466.     typedef Result result_type;
  467. };     
  468.  
  469.  
  470. template <class T>
  471. class plus : public binary_function<T, T, T> {
  472. public:
  473.     T operator()(const T& x, const second_argument_type& y) const { return x + y; };
  474. };
  475.  
  476. plus<int> p;
  477. $__TYPENAME plus<int>::first_argument_type a;
  478. ],
  479.     [],
  480.     [ac_cv_outside_typedef="yes"],
  481.     [AC_DEFINE(__STL_BASE_TYPEDEF_OUTSIDE_BUG) ac_cv_outside_typedef="no"])
  482. AC_MSG_RESULT($ac_cv_outside_typedef)
  483.  
  484. fi
  485.  
  486. AC_MSG_CHECKING(if private type static members initializable)
  487. AC_TRY_COMPILE(
  488.     [struct p_Class { private: struct str_ { 
  489.     int a; str_(int i) : a(i) {}}; static str_ my_int; 
  490.      };
  491.      $__TYPENAME p_Class::str_ p_Class::my_int(0); 
  492.      ],
  493.     [],
  494.     [ac_cv_private="yes"],
  495.     [AC_DEFINE(__STL_UNINITIALIZABLE_PRIVATE) ac_cv_private="no"])
  496. AC_MSG_RESULT($ac_cv_private)
  497.  
  498.  
  499. AC_MSG_CHECKING(for const member constructor bug)
  500. AC_TRY_LINK([
  501. template <class T1, class T2>
  502. struct pair {
  503.     T1 first;
  504.     T2 second;
  505.     pair() {}
  506.     pair(const pair<T1,T2>& o) : first(o.first), second(o.second) {}
  507. };
  508. pair< const int, const int > p;  
  509.      ],
  510.     [],
  511.     [ac_cv_const_constructor_bug="no"],
  512.     [AC_DEFINE(__STL_CONST_CONSTRUCTOR_BUG) ac_cv_const_constructor_bug="yes"])
  513. AC_MSG_RESULT($ac_cv_const_constructor_bug)
  514.  
  515. AC_MSG_CHECKING(for loop inline problems)
  516. AC_TRY_COMPILE(
  517.     [inline int il_foo (int a) { 
  518.       int i; for (i=0; i<a; i++) a+=a;  while (i>0) a-=3; return a; }],
  519.     [(void)il_foo(2);],
  520.     [ac_cv_inline_problems="no"],
  521.     [AC_DEFINE(__STL_LOOP_INLINE_PROBLEMS) ac_cv_inline_problems="yes"])
  522. if test "$ac_cv_inline_problems" = no; then
  523. # check if no warnings have been issued
  524.   if `check_warning` ; then
  525.      ac_cv_inline_problems="no"
  526.   else
  527.    AC_DEFINE(__STL_LOOP_INLINE_PROBLEMS)
  528.    ac_cv_inline_problems="yes"
  529.   fi
  530. fi
  531. AC_MSG_RESULT($ac_cv_inline_problems)
  532.  
  533. AC_MSG_CHECKING(for full specialization syntax)
  534. AC_TRY_LINK(
  535.     [
  536.      template <class T> class fs_foo {};
  537.      template <> class fs_foo<int> {};],
  538.     [ fs_foo<int> i;],
  539.     [AC_DEFINE(__STL_FULL_SPEC_SYNTAX) ac_cv_spec_syntax="yes"],
  540.     [ac_cv_spec_syntax="no"])
  541. AC_MSG_RESULT($ac_cv_spec_syntax)
  542.  
  543. AC_MSG_CHECKING(if unused methods instantiated)
  544. AC_TRY_LINK(
  545.     [
  546.      template <class T> struct um_foo { T* ptr; 
  547.     T* operator ->() { return ptr;}
  548.     T  operator *()  { return *ptr; }
  549.      };
  550.      template <class T>
  551.     int operator == ( const um_foo<T>& x, const um_foo<T>& y)
  552.     {
  553.             return *x == *y;
  554.     }
  555.      struct um_tag { int a ; };
  556.      ],
  557.     [ 
  558.       um_foo<um_tag> f; um_foo<int> a; int b(5); a.ptr=&b;],
  559.     [ac_cv_unused_required="no"],
  560.     [AC_DEFINE(__STL_UNUSED_REQUIRED_BUG) ac_cv_unused_required="yes"]
  561.     )
  562. AC_MSG_RESULT($ac_cv_unused_required)
  563.  
  564. AC_MSG_CHECKING(for pointer-to-member parameter bug)
  565. AC_TRY_COMPILE(
  566.     [
  567. struct pmf_foo {
  568.     int bar() { return 0; };
  569. };
  570.  
  571. template <class Class, class Result> 
  572. class mem_fun_t {
  573. protected:
  574.     typedef Result (Class::*fun_type)(void);
  575.     fun_type ptr;
  576. public:
  577.     mem_fun_t() {}
  578.     mem_fun_t(fun_type p) : ptr(p) {}
  579.     Result operator()(Class* x) const { return (x->*ptr)();}
  580. };
  581.  
  582. template <class Class, class Result>
  583. inline mem_fun_t <Class, Result> 
  584. mem_fun(Result (Class::*ptr)(void)) {
  585.     return mem_fun_t<Class, Result>(ptr);
  586. }
  587. ],
  588.     [pmf_foo pmf; (void)mem_fun(&pmf_foo::bar)(&pmf)],
  589.     [ac_cv_pmf_bug="no"],
  590.     [AC_DEFINE( __STL_MEMBER_POINTER_PARAM_BUG) ac_cv_pmf_bug="yes"])
  591. AC_MSG_RESULT($ac_cv_pmf_bug)
  592.  
  593. AC_MSG_CHECKING(if bad_alloc defined in <new>)
  594. AC_TRY_COMPILE(
  595.     [#include <new.h>
  596.      bad_alloc badalloc_foo() { bad_alloc err; return err;}],
  597.     [(void)badalloc_foo()],
  598.     [AC_DEFINE(__STL_BAD_ALLOC_DEFINED) ac_cv_bad_alloc="yes"],
  599.     [ac_cv_bad_alloc="no"])
  600. AC_MSG_RESULT($ac_cv_bad_alloc)
  601.  
  602. AC_MSG_CHECKING(for __type_traits automatic specialization)
  603. AC_TRY_LINK(
  604.     [template <class T> int tt_foo(const T&) {
  605.     typedef __type_traits<T> traits;
  606.     return 0;
  607.      }],
  608.     [(void)tt_foo(5)],
  609.     [AC_DEFINE(__STL_AUTOMATIC_TYPE_TRAITS) ac_cv_type_traits="yes"],
  610.     [ac_cv_type_traits="no"])
  611. AC_MSG_RESULT($ac_cv_type_traits)
  612.  
  613.  
  614.  
  615. # package options - exceptions
  616. AC_MSG_RESULT(***)
  617. AC_MSG_RESULT($0: Setting implementation options...)
  618. AC_MSG_RESULT(***)
  619.  
  620. AC_ARG_ENABLE(malloc,[--enable-malloc : set default alloc to malloc-based allocator ( malloc_alloc_template<instance_no>, alloc.h )
  621. --disable-malloc : choose (default) sgi allocator (default_alloc_template<threads,no>  alloc.h )],
  622. [
  623. case "$enableval" in
  624.       yes ) AC_MSG_RESULT(Config arg  --enable-malloc : setting malloc_alloc as default alloc) 
  625.                 AC_DEFINE(__STL_USE_MALLOC);;
  626.         * )
  627.                 AC_MSG_RESULT(Config default: using default_alloc_template as default alloc)
  628. esac
  629. ],
  630. [
  631.  AC_MSG_RESULT(Config default: using default_alloc_template as default alloc)
  632. ]
  633. )
  634.  
  635. AC_ARG_ENABLE(newalloc,[--enable-newalloc : set default alloc to new-based allocator ( new_alloc, alloc.h )
  636. --disable-newalloc : choose (default) sgi allocator (default_alloc_template<threads,no>  alloc.h )],
  637. [
  638. case "$enableval" in
  639.       yes ) AC_MSG_RESULT(Config arg  --enable-newalloc : setting new_alloc as default alloc) 
  640.                 AC_DEFINE(__STL_USE_NEWALLOC);;
  641.         * )
  642.                 AC_MSG_RESULT(Config default: using default_alloc_template as default alloc)
  643. esac
  644. ],
  645. [
  646.  AC_MSG_RESULT(Config default: using default_alloc_template as default alloc)
  647. ]
  648. )
  649.  
  650. AC_ARG_ENABLE(defalloc,[--enable-defalloc : make HP-style defalloc.h included in alloc.h )
  651. --disable-defalloc : leave defalloc.h alone)],
  652. [
  653. case "$enableval" in
  654.       yes ) AC_MSG_RESULT(Config arg --enable-defalloc : including HP-style defalloc.h into alloc.h) 
  655.                 AC_DEFINE(__STL_USE_DEFALLOC);;
  656.       * )
  657.           AC_MSG_RESULT(Config default : not including HP-style defalloc.h into alloc.h)
  658. esac
  659. ],
  660. [
  661.           AC_MSG_RESULT(Config default : not including HP-style defalloc.h into alloc.h)
  662. ]
  663. )
  664.  
  665.  
  666. AC_ARG_ENABLE(debugalloc,[--enable-debugalloc : use debug versions of allocators
  667. --disable-debugalloc : not using debug allocators],
  668. [
  669. case "$enableval" in
  670.       yes ) AC_MSG_RESULT(Config arg --enable-debugalloc : use debug versions of allocators ) 
  671.                 AC_DEFINE(__STL_DEBUG_ALLOC);;
  672.       * )
  673.           AC_MSG_RESULT(Config default : not using debug allocators)
  674. esac
  675. ],
  676. [
  677.           AC_MSG_RESULT(Config default : not using debug allocators)
  678. ]
  679. )
  680.  
  681. if test "$ac_cv_exceptions" = yes; then
  682. AC_ARG_ENABLE(exceptions,[--enable-exceptions Use exceptions support (default if posssible)
  683.  --disable-exceptions Don't use exceptions support],
  684. [
  685. case "$enableval" in
  686.            no) AC_DEFINE(__STL_NO_EXCEPTIONS)
  687.                AC_MSG_RESULT(Config arg --disable-exceptions : disabling exceptions by user request);;
  688.            *)  AC_MSG_RESULT(Config default: exceptions enabled)
  689. esac
  690. ],
  691. [AC_MSG_RESULT(Config default: exceptions enabled) ]
  692. )
  693. else
  694.  AC_MSG_RESULT(Compiler restriction : no exceptions support used)
  695. fi
  696.  
  697. if test "$ac_cv_namespaces" = yes; then
  698. AC_ARG_ENABLE(namespaces,[--enable-namespaces Use namespaces (default if posssible)
  699. --disable-namespaces Don't use namespaces support],
  700. [
  701. case "$enableval" in
  702.     no) AC_DEFINE(__STL_NO_NAMESPACES) 
  703.             AC_MSG_RESULT(Config arg --disable-namespaces : code not put into std namespace by user request);;
  704.      *) AC_MSG_RESULT(Config default: code put into std namespace)
  705. esac
  706. ],
  707. [AC_MSG_RESULT(Config default: code put into std namespace)]
  708. )
  709.  
  710. AC_ARG_ENABLE(std,[--enable-std Using namespace std  (default if posssible)
  711. --disable-std Don't use namespace std by default],
  712. [
  713. case "$enableval" in
  714.     no) AC_DEFINE(__STL_NO_USING_STD) 
  715.             AC_MSG_RESULT(Config arg --disable-std : not using namespace std );;
  716.      *) AC_MSG_RESULT(Config default: using namespace std)
  717. esac
  718. ],
  719. [AC_MSG_RESULT(Config default: using namespace std)]
  720. )
  721. else
  722.  AC_MSG_RESULT(Compiler restriction : std namespace not used)
  723. fi
  724.  
  725.  
  726. AC_ARG_ENABLE(abbrevs,[--enable-abbrevs : use abbreviated class names internally for linker benefit (don't affect interface)
  727. --disable-abbrevs : don't use abbreviated names)],
  728. [
  729. case "$enableval" in
  730.       yes ) AC_MSG_RESULT(Config arg --enable-abbrevs : using abbreviated class names internally) 
  731.                 AC_DEFINE(__STL_USE_ABBREVS);;
  732.       * )
  733.           AC_MSG_RESULT(Config default : not using abbreviated class names internally)
  734. esac
  735. ],
  736. [
  737.           AC_MSG_RESULT(Config default : not using abbreviated class names internally)
  738. ]
  739. )
  740.  
  741.  
  742. AC_DEFINE(__AUTO_CONFIGURED)
  743.  
  744. AC_MSG_RESULT(***)
  745. AC_MSG_RESULT($0: setting up headers...)
  746. AC_MSG_RESULT(***)
  747. AC_OUTPUT(stlconf.h:config/stlconf.h)
  748. AC_MSG_RESULT(***)
  749. AC_MSG_RESULT($0: STL package tuned for use with ¥"${CXX}¥" compiler.)
  750. AC_MSG_RESULT($0: To restore original settings - copy ./config/stlconf.h to ./stlconf.h.)
  751. AC_MSG_RESULT(***)
  752.  
  753.